//
//  RegistrationNoticeView.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/4/21.
//  Copyright © 2020 QDSG. All rights reserved.
//

import UIKit

class RegistrationNoticeView: UIView {
    
    var tapClosure: (() -> Void)?
    
    override func awakeFromNib() {
        super.awakeFromNib()
        setUI()
        addTap()
    }
    
    func setUI() {
        self.backgroundColor = .init(hex: "#FEF8EB")
        
        self.addSubview(logoImgView)
        self.addSubview(label)
        self.addSubview(rightArrow)
        
        logoImgView.snp.makeConstraints { (make) in
            make.left.equalTo(16)
            make.width.height.equalTo(14)
            make.centerY.equalToSuperview()
        }
        
        rightArrow.snp.makeConstraints { (make) in
            make.right.equalTo(-16)
            make.width.equalTo(9)
            make.height.equalTo(14)
            make.centerY.equalToSuperview()
        }
        
        label.snp.makeConstraints { (make) in
            make.left.equalTo(logoImgView.snp.right).offset(8)
            make.right.equalTo(rightArrow.snp.left).offset(-8)
            make.centerY.equalToSuperview()
        }
    }
    
    func addTap() {
        let tap = UITapGestureRecognizer(target: self, action: #selector(tapAction))
        self.isUserInteractionEnabled = true
        self.addGestureRecognizer(tap)
    }
    
    @objc func tapAction() {
        tapClosure?()
    }
    
    lazy var label: UILabel = {
        let label = UILabel()
        label.font = .regular_12
        label.textColor = .init(hex: "#E1B26E")
        label.text = "本院挂号须知，挂号前请仔细阅读"
        return label
    }()
    
    lazy var logoImgView: UIImageView = {
        return setImgView(imgName: "warning_notice_iocn")
    }()
    
    lazy var rightArrow: UIImageView = {
        return setImgView(imgName: "warning_arrow_right_icon")
    }()
    
    func setImgView(imgName: String) -> UIImageView {
        let imgView = UIImageView(image: UIImage(named: imgName))
        return imgView
    }
    
    
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

}
